package com.sirc.zp.mapper;

import com.sirc.zp.domain.UserAudit;
import com.sirc.zp.sqlprovider.UserAuditProvider;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * 用户审核表Mapper
 */
@Mapper
public interface UserAuditMapper {
    /**
     * 通过id得到UserAudit实体
     * @param id
     * @return
     */
    @SelectProvider(type= UserAuditProvider.class, method="getUserAuditById")
    public UserAudit getUserAuditById(Integer id);
    /**
     * 通过审核人(aid)和状态查询用户审核信息，即谁需要审核这条信息
     * @param aid
     * @return
     */
    @SelectProvider(type= UserAuditProvider.class, method="getUserAuditByAIdAndStatus")
    public List<UserAudit> getUserAuditByAIdAndStatus(@Param("aid") Integer aid,@Param("status") String status);
    /**
     * 通过审核发起人(uid)和状态查询用户审核信息
     * @param uid
     * @return
     */
    @SelectProvider(type= UserAuditProvider.class, method="getUserAuditByUIdAndStatus")
    public List<UserAudit> getUserAuditByUIdAndStatus(@Param("uid") Integer uid,@Param("status") String status);
    /**
     * 提交一个用户审核
     * @param userAudit 用户审核信息
     * @return
     */
    @SelectKey(statement = "select last_insert_id()", keyProperty = "uaid", before = false, resultType = int.class)
    @InsertProvider(type=UserAuditProvider.class, method="addUserAudit")
    public Integer addUserAudit(UserAudit userAudit);
    /**
     * 通过审核人查询用户审核信息
     * @param aid
     * @return
     */
    @SelectProvider(type= UserAuditProvider.class, method="getUserAuditbyAID")
    public List<UserAudit> getUserAuditbyAID(Integer aid);
    /**
     * 通过审核发起人查询用户审核信息
     * @param uid
     * @return
     */
    @SelectProvider(type= UserAuditProvider.class, method="getUserAuditbyUID")
    public List<UserAudit> getUserAuditbyUID(Integer uid);
    /**
     * 更新用户审核信息
     * @param userAudit
     * @return
     */
    @UpdateProvider(type=UserAuditProvider.class, method="updateUserAudit")
    public Integer updateUserAudit(UserAudit userAudit);
    /**
     * 删除用户审核信息
     * @param id
     * @return
     */
    @DeleteProvider(type=UserAuditProvider.class, method="deleteUserAudit")
    public Integer deleteUserAudit(Integer id);
}
